(function () {
    angular.module('app')
        .component('xxOrderList',{
            templateUrl:'./app/user/order-list/order-list.html',
            controller:ctrl
        });

    function ctrl($scope,$state,mockHttp,userService,OrderListFactory) {

        $scope.orderList = mockHttp.orderList;
        $scope.username = userService.user['username'];
        /*function getOrderListByUsername(username){
            function cb(err, res) {
                //console.log(err,res);
                if(!err) {
                    $scope.orderList = res['res'];
                }
            }
            OrderListFactory.getOrderListByUsername(username, cb);
        }
        getOrderListByUsername($scope.username);*/

        $scope.orderInfo = function (orderId) {
            $state.go('user.order-detail',{orderId:orderId});
        };
        $scope.login = function () {
            $state.go('login');
        };
        $scope.register = function () {
            $state.go('register')
        };
    }
})();
